// 扁平化取出code
export function flatPermission(perms) {
  let codes = [];
  perms.forEach((item) => {
    codes.push({
      code: item.code,
      title: item.title,
      icon: item.icon,
      permissionId: item.permissionId,
      parentPermissionId: item.parentPermissionId,
    });
    if (item.children) {
      codes = codes.concat(flatPermission(item.children));
    }
  });
  return codes;
}
